<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/3/10
 * Time: 17:18
 */


echo "<title>6-13 PHP中循环结构之foreach循环语句(任务二)</title>";
echo "<p style='text-align: center'><a href=\"index.php\"><font size=\"4\">目录</font></a></p>";
header("Content-type: text/html; charset=utf-8");
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";

$students = array(
    '2010'=>'星',
    '2011'=>'星2',
    '2012'=>'星3',
    '2013'=>'星4',
    '2014'=>'星5',
    '2015'=>'星6',
    '2016'=>'星7',
    '2017'=>'星8',
    '2018'=>'星9',
    '2019'=>'星10',
    '2020'=>'星11',
    '2021'=>'星12',
);//10个学生的学号和名字，用数组存储

//使用循环结构遍历数组，获取学号和姓名
foreach($students as $key =>$v)
{
    echo $key.":".$v;//输出（打印）学号：姓名
    echo "<br />";
}
